package JavaFoundation.myLock.locktools;

/*
Semaphore:信号灯：
semaphore.acquire();//获得
semaphore.release();//释放
 */
public class SemaphoreDemo {
    public static void main(String[] args) {
//        Semaphore semaphore = new Semaphore(3);
//        for (int i = 1; i <= 6; i++) {
//            new Thread(()->{
//                try {
//                    semaphore.acquire();
//                    System.out.println(Thread.currentThread().getName()+"==抢到了车位");
//                    TimeUnit.SECONDS.sleep(3);
//                    System.out.println(Thread.currentThread().getName()+"==停车了3秒钟");
//                }catch (Exception e){
//                    e.printStackTrace();
//                }finally {
//                    semaphore.release();
//                }
//            },String.valueOf(i)).start();
//        }
        System.out.println(8*9);

    }
}
